{header}
<script language="JavaScript" src="js/common.js"></script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<table width="100%"  border="0" cellpadding="3" cellspacing="1" class="tableOutborder">
<tr class="tableHeader">
  <td colspan="9">编辑新闻</td>
</tr>
</table>

<form name="form1" id="form1" method="POST" action="news.php?action=add">
<table width="100%"  border="0" cellspacing="1" cellpadding="3" class="tableOutborder">
  <tr class="bg_0">
    <td width="8%" align="right">标题</td><td><input type="text" name="title" id="title" value="{title}"  ></td>
  </tr>
  <tr class="bg_0">
    <td  align="right">新闻类别</td><td><select name="type"><option value="0" <!-- IF type=="0" -->checked<!-- ENDIF -->>行业动态</option>
      <option value="1" <!-- IF type=="1" -->checked<!-- ENDIF -->>公司动态</option> </select></td>
  </tr>
  <tr class="bg_0">
    <td  align="right">新闻分类</td><td>{selecttreelist}</td>
  </tr>
  <tr class="bg_0">
    <td  align="right">排序</td><td>
      <select id="sort" name="sort">
          <option value="" selected>默认</option>
          <option value="1">置顶</option>
      </select>
    </td>
  </tr>
  <tr class="bg_0">
    <td  align="right">新闻内容</td><td><input type="text" name="contentbox" id="contentbox" value=""  >
      <div   style= 'visibility:hidden; '><textarea   rows= "1 " name= "content" id="content"   cols= "1 ">{contents}</textarea> </div> </td>
  </tr>
  <tr class="bg_1">
      <td  align="right"> </td><td colspan="2" valign="left">
      <input type="button" name="Submit" value=" 提交 " onclick="checkinput()" accesskey="s">
      <input name="reset" type="reset" id="reset" value=" 重置 "></td>
      </td>
  </tr>
</table>
</form>
<script type="text/javascript">CKEDITOR.replace('contentbox',{ skin:'v2' })</script>
<script type="text/javascript">
    $(function(){
        $("#catetree").val({cate});
        var content=CKEDITOR.instances.contentbox.setData($("#content").val());

    })
    function checkinput(){
        var title=$("#title").val();
        var catetree=$("#catetree").val();
        var content=$("#content").val();

        if(title==""){alert("请输入标题");$("#title").focus();return false;}
        if(catetree==""){alert("请选择新闻分类");$("#catetree").focus();return false;}

        var content=CKEDITOR.instances.contentbox.getData();

        //如果是火狐浏览器
        function trim(str)
        {
            return str.replace(/(^\s*)|(\s*$)/g,"");
        }//去掉空格
        content=content.replace("<br />","");
        content=content.replace("<br>","");
        content=trim(content);

        if(content==""){alert("请输入新闻内容");$("#content").focus();return false;}
        $("#content").val(content);
        $("#form1").submit();
    }
</script>
{footer}
